Probabilistic summary data structure based encoding for garbage collection

ABSTRACT

A method and apparatus for different embodiments of probabilistic summary data structure based encoding for garbage collection are described. In one embodiment, a method comprises generating a probabilistic summary data structure that represents active blocks of data within a storage device based on identifications of the active blocks or the data within the active blocks. The method also includes performing garbage collection of at least a portion of the storage device based on the probabilistic summary data structure.

FIELD OF THE INVENTION

The invention relates to the field of data storage. More specifically,the invention relates to probabilistic summary data structure basedencoding for garbage collection.

BACKGROUND OF THE INVENTION

The amount of data to be stored continues to grow. In particular, thesize of the applications and the data generated there from isincreasing. Moreover, systems/users are backing up multiple copies of agiven set of data to maintain multiple versions. For example, snapshotsof a given database stored in a server are copied and stored over time,thereby allowing a given version/snapshot of a set of data to berestored. Typically, much of the data remains the same across differentsnapshots. For example, if the data is backed up for a given user on adaily basis and such user is updating only one of the number of filesfor a given day, the data in this file is the only data that has beenmodified. Accordingly, conventional backup operations include thesharing of data across a number of different snapshots/versions toreduce the amount of data being stored.

Furthermore, in some backup systems, the data is not modifiable. Inother words, if given data is updated, such data is copied to adifferent location in the backup storage device (instead of modifyingthe data at the current location). As described, over time, all of thestorage space in the backup storage device will be allocated, as blocksof data in the backup system are no longer active (but still allocated)and need to be deleted there from. Therefore, garbage collectionoperations are performed within these backup systems to delete data thatis no longer active/referenced, thereby reclaiming unused space in thebackup storage device.

A conventional approach for garbage collection of data includes atraditional mark-and-sweep garbage collection, wherein the data isperiodically traversed. When traversing the data during a garbagecollection operation, if the data is referenced, a tracking mechanismthat includes a bit associated with the referenced data is set toindicate that the data is referenced. Accordingly, during a subsequentsweep of the data, for data whose associated tracking bit is set, suchdata is copied to a different location in the backup system. The rangeof the address space of the data that has been swept is then marked asunallocated, thereby allowing the backup system to overwrite this rangeof the address space with new data. There is commonly two ways ofimplementing the tracking mechanism. The first way is to store each ofthe tracking bit as part of the data itself that the bit is tracking. Insuch an implementation, during garbage collection operations, the systemwill typically require multiple accesses to the secondary storage toretrieve the tracking data stored with the data to determine if the datais to be deleted because such data is no longer referenced.

In an effort to reduce accesses to the secondary storage device, thesecond way of implementing the tracking mechanism is to use a separatedata structure for the tracking bits. In particular, the collection ofthese tracking bits into a separate data structure makes the trackingbits more manageable. Even so, the data structure can become very largeas the amount of data that is within the backup storage device grows. Inparticular, there is a one-to-one relationship between given data and abit within the data structure. As the data structure continues to grow,typical systems will not have local memories that are large enough tostore this structure. Accordingly, when there is insufficient space inthe local memory, at least part of the data structure must be stored ina secondary storage device, such as a hard drive (external to localmemory). Therefore, during garbage collection operations, the system hasto perform a number of disk accesses to the hard drive to access thisstructure, thereby slowing down the operation as the number of secondarystorage accesses increases.

Moreover, certain conventional mark-and-sweep garbage collectionoperations perform a targeted cleaning of a segment of address space inthe backup storage device. However, such approaches require the walkingof all of the blocks of data to determine which blocks of data areconsidered inactive and thus eligible for garbage collection. Inparticular, these mark-and-sweep garbage collection operations requirethe walking of all of the blocks of data in order to determine whether agiven block of data is referenced by any other block of data.Disadvantageously, such an approach is not feasible when the number ofblocks of data becomes too great. For example, if a snapshot of a filesystem is a terabyte in size and such a snapshot is taken every 10minutes, over time the walking of the blocks of data during the markingof the garbage collection operations will not have completed prior toanother snapshot being stored within the backup system.

SUMMARY OF THE INVENTION

A method and apparatus for different embodiments of probabilisticsummary data structure based encoding for garbage collection aredescribed. In one embodiment, a method comprises generating aprobabilistic summary data structure that represents active blocks ofdata within a storage device based on identifications of the activeblocks or the data within the active blocks. The method also includesperforming garbage collection of at least a portion of the storagedevice based on the probabilistic summary data structure.

In another embodiment, a method includes performing a set of operationsfor each referenced block of data within at least a portion of anallocated address space in a storage device. One of these operations isgenerating a number of hash values based on hashes of an identificationof a block or the data in the block within the storage device. Anotherof these operations includes setting bits within a summary datastructure at offsets equal to each of the number of hash values, whereina size of the summary data structure fits within memory of a computingdevice that accesses the storage device. Another of these operationsincludes reclaiming the at least a portion of the allocated addressspace based on the summary data structure.

In another embodiment, a method comprises generating a first encodedvalue based on a Bloom filter, where the first encoded valuerepresentative of blocks of data within an allocated address space to becleaned within a storage device. The method also includes locatingblocks of data that are currently referenced by at least one other blockof data and are within an allocated address space to be cleaned based onthe first encoded value. Additionally, the method includes generating asecond encoded value based on a different Bloom filter, the secondencoded value representative of the blocks of data that are currentlyreferenced and within the allocated address space to be cleaned.

In another embodiment, a system includes a storage device to store anumber of blocks of data, wherein the blocks of data that are marked asallocated are non-modifiable. The system also includes a memory to storean encoded value that represents the blocks of data that are currentlyreferenced and within an allocated space to be cleaned within thestorage device.

In another embodiment, a backup system includes a set of one or morestorage trees each representing a version of multiple data, each leafnode of said set of storage trees to include a block of data from saidmultiple data that has been backed up in a set of one or more storagedevices. The backup system table also includes a location tablereferenced by said leaf nodes to identify the backup locations of saidblocks of data in said set of storage devices. The backup system alsoincludes a garbage collection logic to, responsive to deletion of aversion of the multiple data, walk at least part of said set of storagetrees and record with a bloom filter in a summary data structure whichof said blocks of data identified by the part of said set of storagetrees that was walked are still referenced within the multiple data.

In another embodiment, a backup system to back up a file system includesbackup logic to generate a set of trees each representing backupsnapshots of the file system at different times by recording referencesto blocks of backed up data stored in a set of one or more storagedevices. The backup system also includes garbage collection logiccoupled to access the set of trees to at least approximate garbagecollection of unreferenced ones of the blocks of data by tracking, witha Bloom filter, unreferenced ones of the blocks.

BRIEF DESCRIPTION OF THE DRAWINGS

Embodiments of the invention may be best understood by referring to thefollowing description and accompanying drawings which illustrate suchembodiments. The numbering scheme for the Figures included herein aresuch that the leading number for a given element in a Figure isassociated with the number of the Figure. For example, a backup system100 can be located in FIG. 1. However, element numbers are the same forthose elements that are the same across different Figures. In thedrawings:

FIG. 1 illustrates a block diagram of a system that includes garbagecollection operations, according to one embodiment of the invention.

FIG. 2 illustrates a more detailed block diagram of a backup system,according to one embodiment of the invention.

FIG. 3 illustrates a location table for data storage and garbagecollection of such stored data, according to one embodiment of theinvention.

FIG. 4 illustrates a number of storage trees of blocks of data on whichgarbage collection operations are performed, according to one embodimentof the invention.

FIG. 5A illustrates a flow diagram for a Bloom filter-based garbagecollection of data in a secondary storage, according to one embodimentof the invention.

FIG. 5B illustrates a more detailed flow diagram for a Bloomfilter-based garbage collection of data in a secondary storage,according to one embodiment of the invention.

FIG. 5C illustrates a more detailed flow diagram for a Bloomfilter-based garbage collection of data in a secondary storage,according to one embodiment of the invention.

FIGS. 6A–6B illustrate the incorporation of a Bloom filter into garbagecollection of data in a secondary storage, according to embodiments ofthe invention.

FIG. 7 illustrates a block diagram of a system that includes incrementalgarbage collection operations, according to one embodiment of theinvention.

FIG. 8 illustrates a more detailed block diagram of a backup system,according to one embodiment of the invention.

FIG. 9 illustrates a more detailed diagram of a log of backup data,according to one embodiment of the invention.

FIGS. 10A–10B illustrate location tables for data storage and garbagecollection of such data, according to one embodiment of the invention.

FIG. 11 illustrates a flow diagram for an incremental garbage collectionof data stored as a log in a secondary storage, according to oneembodiment of the invention.

FIG. 12 illustrates a more detailed flow diagram for an incrementalgarbage collection of data stored as a log in a secondary storage,according to one embodiment of the invention.

FIG. 13 illustrates a block diagram of a system that includes the Bloomfilter-based garbage collection operations and the incremental garbagecollection operations, according to one embodiment of the invention.

DETAILED DESCRIPTION

A method and apparatus for different embodiments of garbage collectionof data in a secondary storage are described. Although embodiments ofthe invention are described such that the operations are within a backupsystem, embodiments of the invention can also be incorporated into otherstorage systems. Furthermore, the term “tree” is used to refer to anytype of directed acyclical graph.

In the following description, numerous specific details such as logicimplementations, opcodes, means to specify operands, resourcepartitioning/sharing/duplication implementations, types andinterrelationships of system components, and logicpartitioning/integration choices are set forth in order to provide amore thorough understanding of the present invention. It will beappreciated, however, by one skilled in the art that the invention maybe practiced without such specific details. In other instances, controlstructures, gate level circuits and full software instruction sequenceshave not been shown in detail in order not to obscure the invention.Those of ordinary skill in the art, with the included descriptions, willbe able to implement appropriate functionality without undueexperimentation.

References in the specification to “one embodiment”, “an embodiment”,“an example embodiment”, etc., indicate that the embodiment describedmay include a particular feature, structure, or characteristic, butevery embodiment may not necessarily include the particular feature,structure, or characteristic. Moreover, such phrases are not necessarilyreferring to the same embodiment. Further, when a particular feature,structure, or characteristic is described in connection with anembodiment, it is submitted that it is within the knowledge of oneskilled in the art to effect such feature, structure, or characteristicin connection with other embodiments whether or not explicitlydescribed.

In the following description and claims, the terms “coupled” and“connected,” along with their derivatives, may be used. It should beunderstood that these terms are not intended as synonyms for each other.Rather, in particular embodiments, “connected” may be used to indicatethat two or more elements are in direct physical or electrical contactwith each other. “Coupled” may mean that two or more elements are indirect physical or electrical contact. However, “coupled” may also meanthat two or more elements are not in direct contact with each other, butyet still co-operate or interact with each other.

Embodiments of the present invention include features, methods, orprocesses embodied within machine-executable instructions provided by amachine-accessible medium. A machine-accessible medium includes anymechanism which provides (i.e., stores and/or transmits) information ina form accessible by a machine (e.g., a computer, network device,personal digital assistant, manufacturing tool, any device with a set ofone or more processors, etc.). In an exemplary embodiment, amachine-accessible medium includes: machine storage media (such asvolatile and/or non-volatile media (e.g., read only memory (ROM); randomaccess memory (RAM); magnetic disk storage media; optical storage media;flash memory devices; etc.)), as well as machine transmission media(such as electrical, optical, acoustical or other form of propagatedsignals (e.g., carrier waves, infrared signals, digital signals, etc.)).

Such instructions are utilized to cause a general or special purposeprocessor, programmed with the instructions, to perform methods orprocesses of the present invention. Alternatively, the features oroperations of the present invention are performed by specific hardwarecomponents which contain hard-wired logic for performing the operations,or by any combination of programmed data processing components andspecific hardware components. Embodiments of the present inventioninclude software, data processing hardware, data processingsystem-implemented methods, and various processing operations, furtherdescribed herein.

A Bloom filter uses a vector of m bits to summarize the informationabout n data items. Initially, each of the m bits of the vector is setto 0. There are two operations to a Bloom filter: Insert(x) andLookup(x). Insert(x) inserts data item x into the set. Insert(x) uses kindependent hashing functions, h₁, . . . , h_(k), each mapping an item ato [0, . . . m−1] and sets the bits at position h₁(x), . . . h_(k)(x)to 1. Lookup(x) checks if an item x is in the set. Lookup(x) checks allbits at position(s) h₁(x), . . . h_(k)(x) to determine if they are setto 1. If any one of them is 0, then x is definitely not in the set.Otherwise, there is a high probability that x will be in the set.

A number of figures show block diagrams of systems and apparatus forBloom filter-based garbage collection of data in a secondary storage, inaccordance with embodiments of the invention. A number of figures showflow diagrams illustrating operations for Bloom filter-based garbagecollection of data in a secondary storage, according to embodiments ofthe invention. The operations of the flow diagram will be described withreferences to the systems shown in the block diagrams. However, itshould be understood that the operations of the flow diagram could beperformed by embodiments of systems and apparatus other than thosediscussed with reference to the block diagrams, and embodimentsdiscussed with reference to the systems could perform operationsdifferent than those discussed with reference to the flow diagram.

Overview

One aspect of the invention incorporates a Bloom filter into the markingof a mark-and-sweep garbage collection operation for backed up datawithin a secondary storage, such as a file system. In particular, thisaspect of the invention incorporates a Bloom filter to generate anencoded value representative of blocks of data that are marked during amark-and-sweep garbage collection operation. As will be described inmore detail below, embodiments of the invention can perform garbagecollection on data in a secondary storage wherein blocks of data arereferenced by a number of different other blocks of data. In anembodiment, an encoded value (e.g., a probabilistic summary datastructure) is generated based on a Bloom filter and is representative ofthose blocks of data that are within a range of the backed up data to becleaned. In an embodiment, a different encoded value (e.g., a secondprobabilistic summary data structure) is generated based on a Bloomfilter and is representative of those blocks of data that are within arange of the backed up data to be cleaned. These encoded values aresmaller than the data structures of tracking bits of conventionalapproaches, thereby reducing or eliminating accesses to a storage deviceoutside of the local memory to access this information. For instances,in one such embodiment, the size of these encoded values is such thatthe entire encoded value can be stored in a local memory (e.g., randomaccess memory) of a system these garbage collection operations, therebyreducing the number of disk accesses to secondary storage. Accordingly,such an approach allows garbage collection operations based on thisencoded value to execute at a potentially faster rate in comparison toconventional approaches wherein the size of the data structurerepresenting the locations of the active references is too large to bestored within a local memory.

A different aspect of the invention allows for a pruned (reduced)walking of storage trees of data within a backup system during themarking of a mark-and-sweep garbage collection operation. In oneembodiment, the backup data is written as a log. In an embodiment, theincremental garbage collection operations clean the segment that is atthe tail of the log (i.e., the segment having backup data that has beenstored in the storage device for the longest period of time). Further,in one embodiment, the incremental garbage collection operations copythe referenced/active blocks of data to the head of the log. As will bedescribed in more detail below, embodiments of the invention do notrequire the traversal of all blocks of data to determine which of saidblocks are referenced/active within the segment to be cleaned during thegarbage collection operations.

While these two aspects can be used together, they are independent ofeach other. In other words, the garbage collection operations based on aBloom filter as described herein can be used irrespective of theincremental garbage collection operations based on data stored as a logwithin a backup storage device; and vice versa.

Bloom Filter-Based Encoding for Garbage Collection System Description

FIG. 1 illustrates a block diagram of a system that includes garbagecollection operations, according to one embodiment of the invention.FIG. 1 includes a backup system 100 and a target system 101. The targetsystem 101 includes target data 102 that is backed up/stored within andby the backup system 100. The target data 102 may be different types offiles, objects, data structures, etc. The backup system 100 includes abackup logic 124, a garbage collection logic 106, backup data 110, alocation table 112, an active blocks probabilistic summary datastructure 114 and a candidates-for-cleaning probabilistic summary datastructure 115. Garbage collection logic 106 includes a Bloom filterlogic 104.

The backup data 110 includes a number of storage trees of blocks of data108A–108N. One embodiment of the storage trees of the blocks of data 108is described in more detail below in conjunction with FIG. 4. Whiletermed a tree, the storage trees of the blocks of data 108 arerepresentative of other type of structures, such as lists, tables,arrays, etc. For example, in one embodiment, a storage tree couldinclude two tiers, wherein a table references a number of different leafnodes. In an embodiment, the blocks of data stored in the backup data110 are non-modifiable. Accordingly, the current allocated blocks ofdata are not overwritten or modified.

In one embodiment, the storage trees of the blocks of data 108 aresnapshots of the target data 102 over time. For example, the target data102 could be data stored on a server that is backed up once a day.Accordingly, the storage trees of blocks of data 108 are daily snapshotsof the target data 102. However, embodiments of the invention are not solimited. For example, alternatively, the storage trees of the blocks ofdata 108 are parts of the target data 102 (such as particular filedirectories), which are backed up on command from a systemadministrator. As shown, the storage trees of the blocks of data 108overlap, thereby illustrating that the blocks of data may be sharedacross different storage trees. A more detailed embodiment of thestorage trees of the blocks of data 108 and their overlapping isdescribed in more detail below in conjunction with FIG. 4.

The backup logic 124 includes a tracking logic 120 and an allocatorlogic 122. As shown, the backup logic 124 is coupled to retrieve thetarget data 102 from the target system 101. The allocator logic 122within the backup logic 124 stores the target data 102 or a part thereofwithin the backup data 110. As will be further described below, thetracking logic 120 generates a number of storage trees wherein theblocks of data retrieved from the target data 102 are the leaf nodes ofsuch trees. Further, the tracking logic 120 generates a number ofinterior nodes for the storage trees that include references/pointers toother interior nodes and/or leaf nodes within the storage trees.Accordingly, as will be described in more detail below, thereferences/pointers within the interior nodes allow for the sharing ofblocks of data within and among the different storage trees. Forexample, a given storage tree may be a snapshot of a file system fromthe target data 102 at a given time. Therefore, the blocks of data thatare not modified across the different snapshots are shared among thedifferent storage trees.

The garbage collection logic 106 is coupled to the backup data 110, thelocation table 112, the active-blocks probabilistic summary datastructure 114 and the candidates-for-cleaning probabilistic summary datastructure 115. As will be described in more detail below, the locationtable 112 allows for a level of indirection, wherein an identificationof a block of data within the backup data 110 is associated with theaddress of the block of data within the backup data 110. Other blocks ofdata reference a given block of data based on the identification forthis given block of data stored in the location table 112. Accordingly,when blocks of data are moved or copied within the backup data 110, thelocation table 112 only needs to be updated with regard to the change ofaddress for this block of data (rather than each reference). Oneembodiment of the location table 112 is described in more detail belowin conjunction with FIG. 3.

The Bloom filter logic 104 within the garbage collection logic 106generates the active-blocks probabilistic summary data structure 114 andthe candidates-for-cleaning probabilistic summary data structure 115.The generation of these probabilistic summary data structures 114/115 isdescribed in more detail below in conjunction with FIGS. 5A–5C and6A–6B. As further described below, the garbage collection logic 106 usesthe active-blocks probabilistic summary data structure 114 and thecandidates-for-cleaning probabilistic summary data structure 115 todetermine which blocks within the backup data 110 or a part thereof areactive. An active block of data is defined as a block of data that isreferenced by at least one other active block of data or is a root nodeof a storage tree that is still maintained within the backup system.Furthermore, the garbage collection logic 106 moves and/or copies blocksof data based on this determination using the location table 112.

FIG. 2 illustrates a more detailed block diagram of a backup system,according to one embodiment of the invention. In particular, FIG. 2illustrates the backup system 100 that includes a processor 202, thegarbage collection logic 106, the backup logic 124, an input/output(I/O) interface 204 and a memory 216 which are coupled together througha system bus 220.

The I/O interface 204 is coupled to input data into and output data froma target storage device 206 and a backup storage device 208. The targetstorage device 206 stores the target data 102. The backup storage device208 stores the backup data 110, the location table 112 and thecandidates-for-cleaning probabilistic summary data structure 115. Thememory 216 stores the active-blocks probabilistic summary data structure114. In one embodiment, the size of the active-blocks probabilisticsummary data structure 114 is such that the entire summary datastructure can be stored in the memory 216, thereby reducing the numberof secondary storage accesses. For example, in one embodiment, forapproximately a terabyte of data on which the garbage collectionoperations are being performed, the size of the encoded value isapproximately a gigabyte, while the Bloom filter that generates theencoded value includes approximately four to eight hashes.

Accordingly, if the entire active-blocks probabilistic summary datastructure 114 is stored within the memory 216, the garbage collectionlogic 106 is not required to retrieve the active-blocks probabilisticsummary data structure 114 from the backup storage device 208.Therefore, such an approach allows garbage collection operations basedon this summary data structure to execute at a potentially faster ratein comparison to conventional approaches wherein the size of the datastructure representing the locations of the active references is toolarge to be stored within a local memory.

In an embodiment, the backup logic 124, the garbage collection logic 106and the Bloom filter logic 104 may be processes or tasks that can residewithin the memory 216, the backup storage device 208 and/or theprocessor 202 and can be executed within the processor 202. However,embodiments of the invention are not so limited, as the backup logic124, the garbage collection logic 106 and the Bloom filter logic 104 maybe different types of hardware (such as digital logic) executing theprocessing described therein (which is described in more detail below).

FIG. 3 illustrates a location table for data storage and garbagecollection of such stored data, according to one embodiment of theinvention. In particular, FIG. 3 illustrates one embodiment of thelocation table 112.

As shown, the location table 112 includes a block identification column302 and an address column 304. The block identification column 302 andthe address column 304 may include one to a number of entries. A givenentry in the block identification column 302 is associated with a givenentry in the address column 304. A value of the identification of ablock of data is unique relative to the other values of identificationsof blocks of data. While the identification of the blocks of data may bebased on one of a number of different identifications, in oneembodiment, the identification of a block of data is a hash/fingerprintof the data stored in the block of data. In a different embodiment, theidentification of the block of data is a random number assigned when theblock of data is stored in the backup storage device 208. In oneembodiment, the identification of the block of data is a number that issequentially assigned when the block of data is stored in the backupstorage device 208. For example, the first block of data stored in thebackup storage device 208 has an identification of one, the second blockof data has an identification of two, etc. In another embodiment, theidentification of the block of data is a timestamp of when the block ofdata is stored in the backup storage device 208.

As shown in FIG. 3, a block of data at address 451 within the backupstorage device 208 has an identification of 1. The block of data ataddress 21 within the backup storage device 208 has an identification of350. The block of data at address 1492 within the backup storage device208 has an identification of 25. The block of data at address 2990within the backup storage device 208 has an identification of 4500. Theblock of data at address 156 within the backup storage device 208 has anidentification of 14. The block of data at address 5 within the backupstorage device 208 has an identification of 50001. The block of data ataddress 2003 within the backup storage device 208 has an identificationof 805. The block of data at address 2999 within the backup storagedevice 208 has an identification of 1002. The block of data at address1101 within the backup storage device 208 has an identification of 5.

As further described below, the backup logic 124 and the garbagecollection logic 106 use the location table 112 to locate blocks of datathat are referenced based on their identifications instead of theiractual addresses within the backup storage device 208. Accordingly, if afirst block of data includes a reference to a second block of data, thefirst block of data stores the identification of the second block ofdata instead of the address. When the second block of data isdereferenced through the first block of data, the location table 112 isused to translate the identification to the actual address within thebackup storage device 208. Accordingly, when blocks of data are moved orcopied within the backup storage device 208, the location table 112 onlyneeds to be updated with regard to the change of address for this blockof data (rather than each of the different references in the blocks ofdata).

When a block of data is retrieved from the target system 100 and stored(and is representative of or associated with a leaf node of a storagetree) in the backup data 110, the allocator logic 122 generates an entryinto the location table 112 that includes the block identification andthe address where the block of data is stored. When a block of dataassociated with an interior node of a storage tree is created by thetracking logic 120 to allow for the sharing of the blocks of data withinand among the storage trees, the tracking logic 120 also generates anentry into the location table 112 that includes the block identificationand the address.

FIG. 4 illustrates a number of storage trees of blocks of data on whichgarbage collection operations are performed, according to one embodimentof the invention. In one embodiment, the storage trees of the blocks ofdata are snapshots of the target data 102 over time. As shown, thestorage trees of the blocks of data 108 overlap, thereby illustratingthat the blocks of data 108 may be shared across different storagetrees.

The storage trees include two types of data: (1) user-generated data,which is stored at the leaf nodes of the storage trees; and (2)system-generated data, which is stored at the root nodes and interiornodes of the storage trees. The user-generated data includes the data(e.g., files, data structures, etc.) from the target data 102 that isbeing stored in the backup system 100. The system-generated dataincludes the data generated by the backup logic 124 within the backupsystem 100 that allows the overlapping and sharing of user-generateddata, such as between and among different snapshots. For example, a partof a file could be a picture that is stored multiple times within asnapshot and/or stored across different snapshots. If the target data102 is periodically being backed up and stored as a storage tree withinthe backup data 110, some data may not change between the differentsnapshots of the target data 102. Accordingly, instead of storing thesame data multiple times, the backup logic 124 generates thesystem-generated data that provides multiple pointers to the same data.

The nodes of the storage tree represent blocks of data (eithersystem-generated data or user-generated data) having blockidentifications, as described above in conjunction in FIG. 3. As shown,FIG. 4 illustrates two different storage trees that sharesystem-generated data and user-generated data. A first storage treeincludes a root node 402 having a block identification of 1010. The rootnode 402 references/points to an interior node 406 having a blockidentification of 12, an interior node 408 having a block identificationof 458 and an interior node 410 having a block identification of 44.

The interior node 406 references a leaf node 418 having a blockidentification of 1, a leaf node 420 having a block identification of14, a leaf node 422 having a block identification of 350, a leaf node426 having a block identification of 4500, a leaf node 428 having ablock identification of 805. The interior node 408 references aninterior node 414 having a block identification of 33 and an interiornode 416 having a block identification of 1505. The interior node 410references the interior node 416. The interior node 414 references theleaf node 422 and a leaf node 424 having a block identification of 25.The interior node 416 references the leaf node 426, the leaf node 428and a leaf node 430 having a block identification of 1002.

The second storage tree includes a root node 404 having a blockidentification of 8. The root node 404 references the interior node 406,the interior node 410 and an interior node 412 having a blockidentification of 901. The interior node 412 references the interiornode 414 and the interior node 416. The interior node 414 references theleaf node 422 and the leaf node 424. The interior node 416 referencesthe leaf node 426, the leaf node 428 and the leaf node 430. As shown,the second storage tree shares a number of different nodes with thefirst storage tree, in which the new nodes are noted with dashed-lines.

Therefore, as shown, two different nodes from two different storagetrees may reference a same node (see the interior node 408 of the firststorage tree and the interior node 412 of the second storage tree bothreferencing the interior node 414). Further, two different nodes of asame storage tree reference a same node in the same storage tree (seethe interior node 406 and the interior node 414 referencing the leafnode 422). Additionally, two different nodes from a same file in astorage tree reference a same node in the storage tree. For example,assume that the interior node 410 and the interior node 412 are from asame file. Accordingly, these two different nodes both reference theinterior node 416. In an embodiment (not shown by FIG. 4), one nodemakes multiple references to a given node. For example, the interiornode 414 could reference the leaf node 424 multiple times. Accordingly,if the leaf node were picture/text that is repeated multiple times in agiven file, the picture/text could be stored once within the storagetree and referenced multiple times. It should be understood thatdifferent embodiments may allow for one or more different ones of thesetypes of node references.

Bloom Filter-Based Garbage Collection Operations

The operations of the backup system 100 will now be described. FIGS.5A–5C illustrate flow diagrams for Bloom filter-based garbage collectionof data in a secondary storage, according to embodiments of theinvention. FIG. 5A illustrates a flow diagram for a Bloom filter-basedgarbage collection of data in a secondary storage, according to oneembodiment of the invention.

In block 502 of the flow diagram 500, the active blocks within the rangeof the address space to be cleaned are encoded within the active-blocksprobabilistic summary data structure 114. With reference to the backupsystem 100 of FIG. 1, the Bloom filter logic 104 encodes the activeblocks within the range of the address space to be cleaned within theactive-blocks probabilistic summary data structure 114. Returning toFIG. 4 to help illustrate, assume that the leaf node 418 storesuser-generated data that is updated. Accordingly, a new leaf node isgenerated and the reference by the interior node 406 is updated toreference the new leaf node. Therefore, the leaf node 418 is no longerreferenced by any other block within the backup data 110 and isconsidered not active. The Bloom filter logic 104, therefore, encodesthose blocks of data within the range of the address space to be cleanedthat are referenced or are root nodes of a storage tree that is stillbeing maintained with the backup data 110. Accordingly, the Bloom filterlogic 104 locates the active blocks within the backup data 110 based ona traversal of the storage tress of blocks of data 108 that are stillactive/maintained within the backup data 110. In other words, the activeblocks are those blocks associated with nodes of the storage trees ofblocks of data 108 that are still being maintained within the backupdata 110.

In one embodiment, the range of address space to be cleaned is less thanthe entire allocated address space of the backup data 110. Inparticular, the garbage collection logic 106 is to clean a selectedrange of an allocated address space (which could be less than all of theallocated address space) within the backup data 110. In other words, thegarbage collection logic 106 is to move/delete blocks of data within agiven address space of the backup data 110 that is no longer being used.As described above, in an embodiment, the backup system 100 is such thatthe data stored in the backup data 110 is not modifiable. Accordingly,when data within a block is modified, a new block is created within thebackup data 110 for storage of the modified data (not modifying thecurrent block of data). As described, over time, a number of blocks ofdata will be considered unused, and therefore, the backup data 110 willneed to be cleaned to delete blocks of data not referenced.

In one embodiment if the range of the allocated address space to becleaned is less than the entire allocated address space, the Bloomfilter logic 104 uses the candidates-for-cleaning probabilistic summarydata structure 115 to determine if the active block is within the rangeof the allocated address space to be cleaned. In an embodiment, thecandidates-for-cleaning probabilistic summary data structure 115 isgenerated based on a Bloom filter (which is described in more detailbelow in conjunction with FIGS. 6A–6B). A more detailed description ofthis use of the candidates-for-cleaning probabilistic summary datastructure 115 is described below in conjunction with FIG. 5B.

In one embodiment, the garbage collection logic 106 is to clean a rangeof the allocated address space that has been stored within the backupsystem 100 for the longest period of time. For example, the garbagecollection logic 106 could be configured to clean the 100 Gigabytes thathas been stored in the backup data 110 the longest in comparison to theother data therein. In another embodiment, the garbage collection logic106 is to clean a range of the address space within the backup data 110based on when the data was stored therein. For example, the garbagecollection logic 106 is to clean a range of the address space for datastored within the backup data in a given month of a given year. In anembodiment, the garbage collection logic 106 is to clean a range of theaddress space of the backup data 110 associated with a storage tree.Accordingly, the address space for the blocks of data within a givenstorage tree is cleaned. As described, the range of the address space tobe cleaned may or may not be contiguous within the backup data 110.

The encoding of the active blocks within the range of the allocatedaddress space to be cleaned within the active-blocks probabilisticsummary data structure 114 and the encoding of all the blocks within therange of the allocated address space to be cleaned within thecandidates-for-cleaning probabilistic summary data structure 1115, bythe Bloom filter logic 104, based on a Bloom filter will now bedescribed in conjunction with FIGS. 6A–6B. In particular, the generationand use of the probabilistic summary data structure 114/115 based on aBloom filter will now be described. FIGS. 6A–6B illustrate a Bloomfilter for garbage collection of data in a secondary storage, accordingto embodiments of the invention. FIGS. 6A–6B illustrate theincorporation of a Bloom filter into garbage collection of data in asecondary storage based on different configurations of hash logic. Byway of example and not by way of limitation, FIGS. 6A–6B illustrate theinputting of only two different block identification/data (block ID/data606 and 608) into the hash logic 650 and 602.

While in one embodiment the encoding of the blocks of data is anencoding of a block identification (such as a number that issequentially assigned as the blocks of data are stored in the backupdata 110). Alternatively, embodiments encode something different as theblock identification (e.g., a hash or fingerprint of the block of data,a time stamp of when the data is initially stored in the backup data110). In an embodiment, embodiments encode the data within the blockitself.

Prior to the operations illustrated in FIGS. 6A–6B, the probabilisticsummary data structure 114/115 is initialized to zero. After the hashlogic sets the bits based on the different input, the probabilisticsummary data structure 114/115 is a signature or a pattern of bitsrepresentative of the different block ID/data inputted.

The hash logic 602A–602N and the hash logic 650 can be one to a numberof different hash logic. For example, the hash logic 602 and the hashlogic 650 may be Message Digest (MD)5, Secure Hash Algorithm (SHA)-1,etc. In an embodiment, the hash logic 602 and/or the hash logic 650 is aselection of a number of the bits of the input (e.g., all of the evenbits). In one embodiment, the hash logic 602 and/or the hash logic 650is a rearrangement of the bits of the input. In one embodiment, the hashlogic 650 is a relatively more complex hash operation, such as an MD5hash, while the different hash logic 602A–602N are selections and/orrearrangements of the number of bits of inputted.

With regard to FIG. 6A, in operation, the hash logic 602A, the hashlogic 602B, the hash logic 602C and the hash logic 602N are coupled toreceive a block ID/data 606 and a block ID/data 608. Each of the hashlogic 602A–602N generates a value that is an offset into theprobabilistic summary data structure 114/115. Accordingly, the bit atthe offset generated by each of the hash logic 602A–602N is set. Asshown, the hash logic 602A generates an offset value at a bit 620 of theprobabilistic summary data structure 114/115 for the block ID/data 606.Therefore, the hash logic 602A sets the bit 620 of the probabilisticsummary data structure 114/115. In particular, assume that the hashlogic 602A generates a hash value of 20 and that the bit 620 is at anoffset of 20 within the probabilistic summary data structure 114/115.Accordingly, the hash logic 602A sets the bit 620.

The hash logic 602B generates an offset value at a bit 616 of theprobabilistic summary data structure 114/115 for the block ID/data 606.The hash logic 602B sets the bit 616 of the probabilistic summary datastructure 114/115. The hash logic 602C generates an offset value at abit 618 of the probabilistic summary data structure 114/115 for theblock ID/data 606. The hash logic 602C sets the bit 618 of theprobabilistic summary data structure 114/115. The hash logic 602Ngenerates an offset value at a bit 612 of the probabilistic summary datastructure 114/115 for the block ID/data 606. The hash logic 602N setsthe bit 612 of the probabilistic summary data structure 114/115.

The hash logic 602A generates an offset value at a bit 610 of theprobabilistic summary data structure 114/115 for the block ID/data 608.Therefore, the hash logic 602A sets the bit 610 of the probabilisticsummary data structure 114/115. The hash logic 602B generates an offsetvalue at a bit 622 of the probabilistic summary data structure 114/115for the block ID/data 608. The hash logic 602B sets the bit 622 of theprobabilistic summary data structure 114/115. The hash logic 602Cgenerates an offset value at a bit 614 of the probabilistic summary datastructure 114/115 for the block ID/data 608. The hash logic 602C setsthe bit 614 of the probabilistic summary data structure 114/115. Thehash logic 602N generates an offset value at a bit 618 of theprobabilistic summary data structure 114/115 for the block ID/data 608.The bit 618 has already been set by the hash logic 602C for the blockID/data 606.

With regard to FIG. 6B, in operation, the hash logic 650 is coupled toreceive the block ID/data 606 and the block ID/data 608. The outputtedhash from the hash logic 650 is inputted into each of the hash logic602A–602N. As shown, the hash logic 602A generates an offset value at abit 662 of the probabilistic summary data structure 114/115 for theblock ID/data 606. Therefore, the hash logic 602A sets the bit 662 ofthe probabilistic summary data structure 114/115.

The hash logic 602B generates an offset value at a bit 658 of theprobabilistic summary data structure 114/115 for the block ID/data 606.The hash logic 602B sets the bit 658 of the probabilistic summary datastructure 114/115. The hash logic 602C generates an offset value at abit 654 of the probabilistic summary data structure 114/115 for theblock ID/data 606. The hash logic 602C sets the bit 654 of theprobabilistic summary data structure 114/115. The hash logic 602Ngenerates an offset value at a bit 652 of the probabilistic summary datastructure 114/115 for the block ID/data 606. The hash logic 602N setsthe bit 652 of the probabilistic summary data structure 114/115.

The hash logic 602A generates an offset value at a bit 656 of theprobabilistic summary data structure 114/115 for the block ID/data 608.Therefore, the hash logic 602A sets the bit 656 of the probabilisticsummary data structure 114/115. The hash logic 602B generates an offsetvalue at a bit 664 of the probabilistic summary data structure 114/115for the block ID/data 608. The hash logic 602B sets the bit 664 of theprobabilistic summary data structure 114/115. The hash logic 602Cgenerates an offset value at a bit 660 of the probabilistic summary datastructure 114/115 for the block ID/data 608. The hash logic 602C setsthe bit 660 of the probabilistic summary data structure 114/115. Thehash logic 602N generates an offset value at the bit 662 of theprobabilistic summary data structure 114/115 for the block ID/data 608.The bit 662 has already been set by the hash logic 602A for the blockID/data 606.

While, in one embodiment, a given hash logic 602 (hash logic 602A)generates a unique value that is an offset into the probabilisticsummary data structure 114/115, in an embodiment, two different hashlogics may collide by generating a same offset value for two differentblock ID/data. For example, as illustrated, the hash logic 602Cgenerates a same offset value for the block ID/data 606 as the hashlogic 602N for a different block ID/data (the block ID/data 608).

Returning to the flow diagram 500 of FIG. 5A, the Bloom filter logic 104inputs the block identifications or the data within the blocks for eachof the active blocks within the address space to be cleaned into a Bloomfilter to generate the active-blocks probabilistic summary datastructure 114. Accordingly, the active-blocks probabilistic summary datastructure 114 is an encoded value representative of the active blockswithin the address space to be cleaned.

Moreover, as described above, in an embodiment, less than the entireallocated address space is cleaned. Accordingly, in an embodiment, upondetermining that a block is active, the Bloom filter logic 104determines whether the block is within the range to be cleaned. In oneembodiment, the Bloom filter logic 104 uses the candidates-for-cleaningprobabilistic summary data structure 115 to determine if the activeblock is within the range of the address space to be cleaned. The Bloomfilter logic 104 inputs the block identification/data into the hashlogic for the Bloom filter that generated the candidates-for-cleaningprobabilistic summary data structure 115. If one of the bits at theoffsets (outputted from the hash logic) is set to zero, the block is notwithin the range of the address space to be cleaned. Conversely, if allof the bits at the offsets (outputted from the hash logic) are set toone, the block is considered to be within the range of the address spaceto be cleaned.

Moreover, if there is a match (i.e., if all of the bits at the offsetsare set to one), there is not an absolute certainty that the block isconsidered to be encoded in the candidates-for-cleaning probabilisticsummary data structure 115. In particular, collisions across the outputof different hash logic may provide a false indication that a givenblock ID/data is encoded within the probabilistic summary data structure114/115. Returning to FIG. 6A to help illustrate, assume that a blockID/data is inputted into each of the hash logic 602A–602N to determineif the block ID/data is encoded within the probabilistic summary datastructure 114/115. For this inputted block ID/data, assume that theoutput from the hash logic 602A is at an offset for the bit 614 (whichwas set by the hash logic 602C for the block ID/data 608). Furthermore,for this inputted block ID/data, assume that the output from the hashlogic 602B is at an offset for the bit 610 (which was set by the hashlogic 602A for the block ID/data 608). For this inputted block ID/data,assume that the output from the hash logic 602C is at an offset for thebit 612 (which was set by the hash logic 602N for the block ID/data 606.For this inputted block ID/data, assume that the output from the hashlogic 602N is at an offset for the bit 622 (which was set by the hashlogic 602B for the block ID/data 608). Accordingly, even though thisdifferent ID/data was not inputted into the hash logic 602A–602N for thegeneration of the probabilistic summary data structure 114/115, theprobabilistic summary data structure 114/115 provides a false indicationas that this different ID/data is encoded therein based on the settingof bits by the hash logic for other block ID/data.

Accordingly, the garbage collection operations described herein areapproximations that serve as a trade off for allowing a single encodedvalue to be stored in local memory for potentially faster operations.Therefore, the cost of allowing the single encoded value to be stored inlocal memory is the erroneous marking of a limited number of blocks ofdata as being within the range of the address space to be cleaned, whileallowing for a potential increase in the rate of garbage collectionoperations (whose relative potential grows in comparison to conventionalapproaches as the amount of data on which garbage collection operationsare being performed grows). Moreover, the probability of receiving anerroneous match based on the probabilistic summary data structure114/115 depends on the size of the probabilistic summary data structure114/115 relative to the number of block ID/data that are inputtedtherein as well as the number of hash logic for the Bloom filter.

Returning to block 502, once the active block is considered to be withinthe range of the address space to be cleaned, the Bloom filter logic 104encodes the active block within the active-blocks probabilistic summarydata structure 114 based on a different Bloom filter operation. Theencoding, by the Bloom filter logic 104, of the active blocks within therange of the address space to be cleaned within the active-blocksprobabilistic summary data structure 114 based on a Bloom filter hasbeen described in conjunction with FIGS. 6A–6B. Control continues atblock 504.

In block 504, the range of the address space to be cleaned is cleanedbased on the active-blocks probabilistic summary data structure 114.With reference to the backup system 100 of FIG. 1, the garbagecollection logic 106 cleans the range of the address space to be cleanedwithin the backup data 110 based on the active-blocks probabilisticsummary data structure 114. In one embodiment, the garbage collectionlogic 106 cleans the range of the address space to be cleaned within thebackup data 110 by copying the active blocks within the range of theaddress space to be cleaned to an unallocated part of the address spacewithin the backup storage device 208 and marking this range of theaddress space as unallocated. Accordingly, the backup logic 124 canstore new backup data within this range of the address space.

However, embodiments of the invention are not so limited. In anotherembodiment, the garbage collection logic 106 marks (based on theprobabilistic summary data structures 114/115) the inactive blockswithin the range of the address space to be cleaned as unallocated.Accordingly, the backup logic 124 can store new backup data within theseunallocated sections of the range of the address space to be cleaned. Inone embodiment, the garbage collection logic 106 moves the active blocksof data within this range of the address space, such that the activeblocks of data remain in this address space and are stored contiguouslytherein.

More detailed embodiments of the use of a Bloom filter for garbagecollection will now be described in conjunction with FIGS. 5B–5C. FIG.5B illustrates a more detailed flow diagram for a Bloom filter-basedgarbage collection of data in a secondary storage, according to oneembodiment of the invention. The flow diagram 530 of FIG. 5B illustratesa mark-and-sweep garbage collection operation that includes a Bloomfilter for the active blocks of data to be cleaned and possibly a secondBloom filter for the blocks of data in a range of an address space ofthe secondary storage to be cleaned. As will be described, theoperations in blocks 532–538 are related to the marking operations,while the operations in blocks 540–550 are related to the sweepingoperations.

In block 532, a determination is made of whether the range of data to becleaned is less than the entire allocated address space of the backupdata 110. With reference to the backup system 100, the garbagecollection logic 106 determines whether the range of data to be cleanedis less than the entire allocated address space of the backup data 110.As described above, a targeted range, such as a range of blocks of datathat have resided in the backup data 110 for the longest period of time,will be selected for cleaning.

In block 534, upon determining that the range of data to be cleaned isless than the entire allocated address space of the backup data 110, thecandidates-for-cleaning probabilistic summary data structure 115(representative of the blocks of data in the range to be cleaned) isgenerated based on a traversal of the range to be cleaned. Withreference to the backup system 100, the Bloom filter logic 104 generatesthe candidates-for-cleaning probabilistic summary data structure 115based on a traversal of the range to be cleaned. As described above, theBloom filter logic 104 generates the candidates-for-cleaningprobabilistic summary data structure 115 by inputting the data withinthe blocks within the range to be cleaned or identifications of suchblocks into a Bloom filter (such as the Bloom filters illustrated inFIGS. 6A–6B).

The Bloom filter logic 104 walks the address space for the range to becleaned and locates the blocks in this address space. In an embodiment,the backup data 110 is stored as a logical log having a number ofrecords. A record in a logical log stores a block of data and a headerthat includes information about the block of data (such as the size ofthe record, the size of the block of data, a block identification, atime stamp of when the block was stored in the logical log, etc.). Amore detailed description of a logical log is described below inconjunction with FIG. 9. Returning to block 534, when the backup data110 is a logical log, the Bloom filter logic 104 walks the records ofthe range to be cleaned and inputs the block ID/data for each of theblocks in the range of the address space to be cleaned. Controlcontinues at block 536.

In block 536, the active-blocks probabilistic summary data structure 114(representative of the active blocks of data in the range to be cleaned)is generated based on the candidates-for-cleaning probabilistic summarydata structure 115. With reference to the backup system 100, the Bloomfilter logic 104 generates the active-blocks probabilistic summary datastructure 114 based on the candidates-for-cleaning probabilistic summarydata structure 115. As describe above in conjunction with FIG. 5A, theBloom filter logic 104 locates the active blocks within the backup data110 based on a traversal of the storage tress of blocks of data 108 thatare still active/maintained within the backup data 110.

Moreover, when an active block has been located, the Bloom filter logic104 inputs the block ID/data for this active block into the Bloom filterthat generated the candidates-for-cleaning probabilistic summary datastructure 115 to determine if the active block is within the range to becleaned. As described above in conjunction with FIGS. 6A–6B, if theoutput from each of the hash logic 602 of this Bloom filter is such thatthe offsets into the candidates-for-cleaning probabilistic summary datastructure 115 are set to one, the block is considered to be encodedwithin the candidates-for-cleaning probabilistic summary data structure115 and thus a block in the range to be cleaned.

If the block is within the range to be cleaned, the Bloom filter logic104 inputs the block ID/data for this block into a different Bloomfilter to generate the active-blocks probabilistic summary datastructure 114. After the storage trees of the blocks of data 108 thatare still maintained have been traversed and the active blocks of datawithin the range to be cleaned are inputted into the different Bloomfilter to generate the active-blocks probabilistic summary datastructure 114, control continues at block 540 (which is describedbelow).

In block 538, upon determining that the range of data to be cleaned isthe entire allocated address space of the backup data 110, theactive-blocks probabilistic summary data structure 114 is generated(representative of the active blocks of data in the entire allocatedaddress space of the backup data 110). With reference to the backupsystem 100, the Bloom filter logic 104 generates the active-blocksprobabilistic summary data structure 114. Similar to the generation ofthe active-blocks probabilistic summary data structure 114 in block 536,the Bloom filter logic 104 locates the active blocks within the backupdata 110 based on a traversal of the storage tress of blocks of data 108that are still active/maintained within the backup data 110. However,because the entire allocated address space is being cleaned, thecandidates-for-cleaning probabilistic summary data structure 115 is notrequired. Therefore, when active blocks are located based on thetraversal of the storage trees of blocks of data 108, the Bloom filterlogic 104 inputs the block ID/data for these active blocks into theBloom filter for the active blocks to generate the active-blocksprobabilistic summary data structure 114 (as described above inconjunction with FIGS. 6A–6B). Control continues at block 540.

In block 540, a determination is again made of whether the range of datato be cleaned is less than the entire allocated address space of thebackup data 110. With reference to the backup system 100, the garbagecollection logic 106 determines whether the range of data to be cleanedis less than the entire allocated address space of the backup data 110.

In block 542, upon determining that the range of data to be cleaned isless than the entire allocated address space of the backup data 110, adetermination is made of whether all blocks of data in the range to becleaned have been processed. With reference to the backup system 100,the garbage collection logic 106 determines whether all blocks of datain the range to be cleaned have been processed. Within the operations ofblocks 540–544 and 550–554, the garbage collection logic 106 traversesthe blocks of data within the range of the address space to be cleaned.Accordingly, the garbage collection logic 106 tracks when suchoperations have been performed for all of the blocks of data within therange to be cleaned. Upon determining that all of the blocks in therange have been processed, control continues at block 556 (which isdescribed in more detail below).

In block 544, upon determining that all of the blocks of data within therange to be cleaned have not been processed, a block of data within therange to be cleaned is retrieved. With reference to the backup system100, the garbage collection logic 106 retrieves a block of data withinthe range to be cleaned. In an embodiment, in order to reduce the numberof disk accesses, the garbage collection logic 106 retrieves a pluralityof blocks of data within the range to be cleaned from the backup storagedevice 208 during a single disk access and stores these blocks of datawithin the memory 216. The garbage collection logic 106 then processesthe blocks of data as described below and retrieves additional blocks ofdata during a subsequent disk access when the blocks of data, which havealready been retrieved, have been processed. Accordingly, this reducesthe number of disk accesses during the garbage collection operations.Control continues at block 550 (which is described in more detailbelow).

In block 546, upon determining that the range of data to be cleaned isnot less than the entire allocated address space of the backup data 10,a determination is made of whether all blocks of data in the allocatedaddress space have been processed. With reference to the backup system100, the garbage collection logic 106 determines whether all blocks ofdata in the allocated address space have been processed. Within theoperations of blocks 540 and 546–554, the garbage collection logic 106traverses the blocks of data within the allocated address space.Accordingly, the garbage collection logic 106 tracks when suchoperations have been performed for all of the blocks of data within theallocated address space. Upon determining that all of the blocks in theallocated address space have been processed, control continues at block556 (which is described in more detail below).

In block 548, upon determining that all of the blocks of data within theallocated address space have not been processed, a block of data withinthe allocated address space is retrieved. With reference to the backupsystem 100, the garbage collection logic 106 retrieves a block of datawithin the allocated address space. Control continues at block 550.

In block 550, a determination is made of whether the retrieved block ofdata is active based on the active-blocks probabilistic summary datastructure 114. With reference to the backup system 100, the garbagecollection logic 106 determines whether the retrieved block of data isactive based on the active-blocks probabilistic summary data structure114. In order to make this determination, the garbage collection logic106 inputs the block identification/data for this block of data into thehash logic for the Bloom filter that generated the active-blocksprobabilistic summary data structure 114. If one of the bits at theoffsets (outputted from the hash logic) is set to zero, the block is notactive. Conversely, if all of the bits at the offsets (outputted fromthe hash logic) are set to one, the block is active. In other words, thegarbage collection logic 106 compares the outputted value of the Bloomfilter for the retrieved blocks with the active-blocks probabilisticsummary data structure 114 to determine if the blocks are active. Upondetermining that the retrieved block of data is not active, controlcontinues at block 540.

In block 552, upon determining that the retrieved block of data isactive, the block of data is copied into an unallocated range of theaddress space of the backup data 110. With reference to the backupsystem 100, the garbage collection logic 106 copies the block of data toan unallocated range of the address space of the backup data 110.Control continues at block 554.

In block 554, the address of the block that is copied is updated. Withreference to the backup system 100, the garbage collection logic 106updates the address of the block that is copied. As described above, thelocation table 112 includes an identification of a block of data that isassociated with the address of the block. Accordingly, the garbagecollection logic 106 updates the address of the block by updating theaddress of the block in the location table 112. Control continues atblock 540.

In block 556, when all of the blocks of data within the range to becleaned (from block 542) or the blocks of data within the allocatedaddress space (from block 546) are processed, the address space that wascleaned in the backup data 110 is marked as unallocated. With referenceto the backup system 100, the garbage collection logic 106 marks thisaddress space that was cleaned in the backup back data 110 asunallocated. Accordingly, all of the blocks of data within this addressspace (including the inactive blocks that were not copied and the activeblocks that were copied) can be overwritten by other data to be backedup within the backup system 100 by the backup logic 124.

As described, instead of marking each block of data with its own privatebit or set of bits, embodiments of the invention generate a singleencoded value representative of each of the blocks of data, wherein asize of the encoded value is such that the encoded value can be storedwithin a local memory of the backup system 100. Accordingly, during thegarbage collection operations described above, disk or secondary storageaccesses are not required to retrieve this encoded value, therebypotentially increasing the speed of the garbage collection operations incomparison to conventional garbage collection operations, especially forbackup systems having a large amount of data.

FIG. 5C illustrates a more detailed flow diagram for a Bloomfilter-based garbage collection of data in a secondary storage,according to another embodiment of the invention. The flow diagram 560of FIG. 5C illustrates a mark-and-sweep garbage collection operationthat includes a Bloom filter for the active blocks of data andindependent of a second Bloom filter for the blocks of data in a rangeof an address space of the secondary storage to be cleaned. As will bedescribed, the operations in block 562 are related to the markingoperations, while the operations in blocks 564–580 are related to thesweeping operations.

In block 562, the active-blocks probabilistic summary data structure 114is generated (representative of the active blocks of data in the rangeof the allocated address space of the backup data 110 to be cleaned).With reference to the backup system 100, the Bloom filter logic 104generates the active-blocks probabilistic summary data structure 114 (asdescribed above). In the embodiment illustrated in the flow diagram 560,whether the entire allocated address space or a range thereof iscleaned, the Bloom filter logic 104 generates the active-blocksprobabilistic summary data structure 114 without a summary datastructure representative of the blocks of data within the address spacebeing cleaned. Accordingly, the Bloom filter logic 104 traverses thestorage trees of blocks of data 108 to locate all of active blocks inthe allocated address space (including potentially those blocks that arenot in the range to be cleaned). The Bloom filter logic 104 inputs theblock ID/data for these active blocks into the Bloom filter for theactive blocks to generate the active-blocks probabilistic summary datastructure 114 (as described above in conjunction with FIGS. 6A–6B).Control continues at block 564.

In block 564, a determination is made of whether the range of data to becleaned is less than the entire allocated address space of the backupdata 110. With reference to the backup system 100, the garbagecollection logic 106 determines whether the range of data to be cleanedis less than the entire allocated address space of the backup data 110.

In block 566, upon determining that the range of data to be cleaned isless than the entire allocated address space of the backup data 110, adetermination is made of whether all blocks of data in the range to becleaned have been processed. With reference to the backup system 100,the garbage collection logic 106 determines whether all blocks of datain the range to be cleaned have been processed. Upon determining thatall of the blocks in the range have been processed, control continues atblock 580 (which is described in more detail below).

In block 568, upon determining that all of the blocks of data within therange to be cleaned have not been processed, a block of data within therange to be cleaned is retrieved. With reference to the backup system100, the garbage collection logic 106 retrieves a block of data withinthe range to be cleaned. Control continues at block 574 (which isdescribed in more detail below).

In block 570, upon determining that the range of data to be cleaned isnot less than the entire allocated address space of the backup data 110,a determination is made of whether all blocks of data in the allocatedaddress space have been processed. With reference to the backup system100, the garbage collection logic 106 determines whether all blocks ofdata in the allocated address space have been processed. Upondetermining that all of the blocks in the allocated address space havebeen processed, control continues at block 580 (which is described inmore detail below).

In block 572, upon determining that all of the blocks of data within theallocated address space have not been processed, a block of data withinthe allocated address space is retrieved. With reference to the backupsystem 100, the garbage collection logic 106 retrieves a block of datawithin the allocated address space. Control continues at block 574.

In block 574, a determination is made of whether the retrieved block ofdata is active based on the active-blocks probabilistic summary datastructure 114. With reference to the backup system 100, the garbagecollection logic 106 determines whether the retrieved block of data isactive based on the active-blocks probabilistic summary data structure114. Upon determining that the retrieved block of data is not active,control continues at block 564.

In block 576, upon determining that the retrieved block of data isactive, the block of data is copied into an unallocated range of theaddress space of the backup data 110. With reference to the backupsystem 100, the garbage collection logic 106 copies the block of data toan unallocated range of the address space of the backup data 110.Control continues at block 578.

In block 578, the address of the block that is copied is updated. Withreference to the backup system 100, the garbage collection logic 106updates the address of the block that is copied. Control continues atblock 564. In block 580, when all of the blocks of data within the rangeto be cleaned (from block 542) or the blocks of data within theallocated address space (from block 546) are processed, the addressspace that was cleaned in the backup data 110 is marked as unallocated.With reference to the backup system 100, the garbage collection logic106 marks this address space that was cleaned in the backup back data110 as unallocated.

Incremental Garbage Collection of Data in a Secondary Storage

System Description

FIG. 7 illustrates a block diagram of a system that includes incrementalgarbage collection operations, according to one embodiment of theinvention. These garbage collection operations are incremental in thatthey allow the garbage collection logic to perform mark and sweep on arange of backup storage at a time, as opposed to the entire backupstorage. Similar to FIG. 1, FIG. 7 includes a backup system 700 and thetarget system 101. The target system 101 includes the target data 102that is backed up/stored within and by the backup system 700. The backupsystem 700 includes a backup logic 124, a garbage collection logic 706,a nonreferencing nodes location table 702, a referencing nodes locationtable 704 and a log of backup data 708. The backup logic 124 includes atracking logic 120 and an allocator logic 122.

As in the backup system 100, the backup system 700 includes backup datastored therein. However, the backup system 700 stores the backup data asa log (i.e., the log of backup data 708). In one embodiment (which isdescribed in more detail below in conjunction with FIG. 9), the backupsystem 700 stores the backup data as a contiguous log in a sequentialorder, wherein the backup data is wrapped around to the beginning of thelog once the end is reached and the beginning of the log has beencleaned. For example, the allocator logic 122 begins writing data intothe contiguous log of backup data 708 beginning at address zero andcontinuing until the end of the physical address space. The allocatorlogic 122 wraps around to the beginning of the physical address spaceand begins storing the data at the physical address zero. However,embodiments of the invention are not so limited, as embodiments of theinvention can incorporate any type of log having a collection of recordsthat are laid out in order. Moreover, the order of the log is notrequired to be the order that the log is stored in a physical space. Forexample, the records of the log can be logically coupled together in anorder of the log, while being stored in a different order physically ina storage device.

As further described below, the garbage collection logic 706 uses thenonreferencing nodes location table 702 and the referencing nodeslocation table 704 to perform incremental garbage collection of asegment of the log of backup data 708. In one embodiment, the garbagecollection logic 706 cleans the segment of the log of backup data 708that is at the tail of the log (i.e., the segment having backup datathat has been stored in the storage device for the longest period oftime). In one embodiment, the garbage collection operations include theidentification of the referenced/active blocks of data in the segmentand the copying of these referenced/active blocks of data to the head ofthe log of backup data 708.

The log of backup data 708 includes a number of storage trees of blocksof data 710A–710N. One embodiment of the storage trees of blocks of data710 is described in conjunction with FIG. 4. In particular, thedifferent nodes of the storage tress of blocks of data 710 arerepresentative of blocks of data stored at different locations withinthe log of backup data 708. Similar to the blocks of data 110, in anembodiment, the backup data within the contiguous log of backup data 708are non-modifiable.

The backup logic 124 is coupled to retrieve the target data 102 from thetarget system 101 and to store the target data 102 or a part thereofwithin the log of backup data 708. The garbage collection logic 706 iscoupled to the log of backup data 708, the nonreferencing nodes locationtable 702 and the referencing nodes location table 704. As will bedescribed in more detail below, similar to the location table 112, thenonreferencing nodes location table 702 and the referencing nodeslocation table 704 allow for a level of indirection, wherein anidentification of a block of data within the log of backup data 708 isassociated with an offset address within the log of backup data 708.Accordingly, such tables are used when the blocks of data are copied ormoved within the contiguous log of backup data 708. Embodiments of thenonreferencing nodes location table 702 and the referencing nodeslocation table 704 are described in more detail below in conjunctionwith FIGS. 10A–10B.

FIG. 8 illustrates a more detailed block diagram of a backup system,according to one embodiment of the invention. FIG. 8 illustrates thebackup system 700 that includes the processor 202, a garbage collectionlogic 706, the backup logic 124, the input/output (I/O) interface 204and the memory 216 which are coupled together through the system bus220. A number of the components of the backup system 700 are the similarto a number of components of the backup system 200 and have beendescribed above in conjunction with FIG. 2.

For the backup system 700, the backup storage device 208 stores the logof backup data 708, the referencing nodes location table 702 and thenonreferencing nodes location table 704. Additionally, at least a partof the log of backup data 708, the referencing nodes location table 702and the nonreferencing nodes location table 704 may be stored in thememory 216.

In an embodiment, the garbage collection logic 706 may be a process ortask that can reside within the memory 216, the backup storage device208 and/or the processor 202 and can be executed within the processor202. However, embodiments of the invention are not so limited, as thegarbage collection logic 706 may be different types of hardware (such asdigital logic) executing the processing described therein (which isdescribed in more detail below).

FIG. 9 illustrates a more detailed diagram of a log of backup data,according to one embodiment of the invention. In particular, FIG. 9illustrates a more detailed diagram of the log of backup data 708,according to one embodiment of the invention. The embodiment of a logillustrated in FIG. 9 is stored physically in a sequential wrap aroundorder. However (as described above), embodiments of the invention arenot so limited, as embodiments of the invention can incorporate any typeof log having a collection of records that are laid out in order.

As shown, the log of backup data 708 includes a physical address spacethat ranges from zero to 1500. A tail of the log of backup data 708 isshown at address 100, while a head 904 of the log of backup data 708 isshown at address 1400. As described above, the tail 902 and the head 904move as the allocated address space of the log of backup data changesand moves over time.

The allocator logic 122 stores blocks of data in the log of backup data708 sequentially in a wrap around order. Initially (when no data isstored in the log of backup data 708), the tail 902 and the head 904 areat address zero. The allocator logic 122 stores a first block of data atthe address zero and continues storing the subsequent blocks of data atsubsequent addresses. For example, if the size of the first block ofdata stored is such that the first 50 addresses are occupied, the secondblock of data is stored starting at address 51. After storage of thefirst block of data, the tail 902 would remain at address zero and thehead 904 would be at address 51.

Moreover, once the blocks of data stored in the log of backup data 708is such that the data occupies addresses up to 1500, the allocator logic122 begins storing data at the beginning of the physical address spacebut having a logical address based on the number of times that theallocator logic 122 has wrapped around. For example, the logical addressfor the physical address zero after a first wrap around is 1501, thelogical address for the physical address zero after a second wrap aroundis 3001, etc.

Accordingly, the garbage collection logic 706 is to clean segments ofthe address space to allow for storage of new data in such segments. Inone embodiment, the garbage collection logic 706 cleans a segment of theaddress space at the tail 902 of the log of backup data 708. As furtherdescribed below, the cleaning of the segment includes copying thereferenced/active blocks of data that are within the segment to the head904 of the log, which is considered unallocated. For example, assumethat the tail 902 of the log is at address zero and that the blocks ofdata from address zero to address 100 are to be cleaned and that thehead 904 of the log is at address 1001. The garbage collection logic 706copies the referenced/active blocks of data within the address spacebetween zero and 100 to the address space beginning at address 1001.Assume that the garbage collection logic 706 stores thisreferenced/active blocks of data from 1001 to 1100. The garbagecollection logic 706 also marks the address space from zero to 100 asunallocated. Accordingly, the allocator logic 122 can store new data inthis address space once storage of the data wraps back around to thebeginning.

Furthermore, the tail 902 of the log is now at address 101, while thehead 904 of the log is 1101. The garbage collection logic 706 canrepetitively clean another segment at the tail 902 of the log and copythe referenced/active blocks within such segment to the head 904 of thelog. Accordingly, as described, embodiments of the invention store dataat the head 904 of the log while cleaning segments of such data at thetail 902, thereby allowing the data to be contiguously stored thereinsuch that the data wraps around the log. Further, the addresses of theblocks of data stored in the log are defined by a logical address basedon the physical address and the number of times that the data haswrapped around. For example, for a block of data stored at a physicaladdress of 1400, the logical address after a first wrap around is 2901,the logical address after a second wrap around is 4402, etc. Theoperations of the storage of data into the log of backup data 708 aredescribed in more detail below.

FIGS. 10A–10B illustrate location tables for data storage and garbagecollection of such data, according to one embodiment of the invention.In particular, FIG. 10A illustrates the nonreferencing nodes locationtable 702 while FIG. 10B illustrates the referencing nodes locationtable 704 for data storage and garbage collection of such data,according to one embodiment of the invention. While describe as twoseparate tables, the nonreferencing nodes location table 702 and thereferencing nodes location table 704 may be one table, wherein theentries will include the three columns illustrated in the referencingnodes location table 704 such that entries having nonreferencing nodeswill leave the minimum offset column 1010 a value representing anon-referencing node (e.g., the initialization value).

With regard to FIG. 10A, similar to the location table 112 of FIG. 3,the nonreferencing nodes location table 702 includes a blockidentification column 1002 and an address column (an offset addresscolumn 1004). The block identification column 1002 and the offsetaddress column 1004 may include one to a number of entries. A givenentry in the block identification column 1002 is associated with a givenentry in the offset address column 1004. Furthermore, as described abovein conjunction with FIG. 9, the offset addresses stored in the offsetaddress column 1004 are logical addresses based on the physical addressand the number of times the stored data has wrap around the addressspace.

A value of the identification of a block of data is unique relative tothe other values of identifications of blocks of data. While theidentification of the blocks of data may be based on one of a number ofdifferent identifications, in one embodiment, the identification of ablock of data is a hash/fingerprint of the data stored in the block ofdata. However, embodiments of the invention are not so limited, as theidentification of a block of data can be other types of numbers, such asa random number assigned when the block of data is stored in the backupstorage device 208 a sequentially assigned number when the block of datais stored in the backup storage device 208 a timestamp of when the blockof data is stored in the backup storage device 208, etc.

As shown in FIG. 10A, a block of data at address 503 within the backupstorage device 208 has an identification of 27. The block of data ataddress 21 within the backup storage device 208 has an identification of358. The block of data at address 1558 within the backup storage device208 has an identification of 103. The block of data at address 3002within the backup storage device 208 has an identification of 18. Theblock of data at address 161 within the backup storage device 208 has anidentification of 132. The block of data at address 7 within the backupstorage device 208 has an identification of 4500. The block of data ataddress 2001 within the backup storage device 208 has an identificationof 55501. The block of data at address 1513 within the backup storagedevice 208 has an identification of 4502. The block of data at address998 within the backup storage device 208 has an identification of 11.

With regard to FIG. 10B, similar to the location table 112 of FIG. 3,the referencing nodes location table 704 includes a block identificationcolumn 1006 and an address column (an offset address column 1008).Additionally, the referencing nodes location table 704 includes aminimum offset column 1010. The minimum offset for a block of datastored in the log of backup data 708 is the smallest valued address of ablock of data that is referenced by the block of data. In other words,for a given node, the minimum offset is the smallest valued address fromamong the descendent nodes of the given node. Returning to FIG. 4 tohelp illustrate, for the block of data for the interior node 408, theminimum offset is the smallest valued address from among the blocks ofdata for nodes that the interior node 408 references (i.e., the interiornode 414, the leaf node 422, the leaf node 424, the interior node 416,the leaf node 426, the leaf node 428 and the leaf node 430). Forexample, assume the block of data for the interior node 414 is stored ataddress 101, the block of data for the leaf node 422 is stored ataddress 150, the block of data for the leaf node 424 is stored ataddress 1050, the block of data for the interior node 416 is stored ataddress 2550, the block of data for the leaf node 426 is stored ataddress 12, the block of data for the leaf node 428 is stored at address1670 and the block of data for the leaf node 430 is stored at address554. Accordingly, the minimum offset for the block of data for theinterior node 408 is 12.

In the referencing nodes location table 704 of FIG. 10B, a block of dataat address 557 within the backup storage device 208 has anidentification of 12 and a minimum offset 1101. A block of data ataddress 97 within the backup storage device 208 has an identification of458 and a minimum offset 5. A block of data at address 1411 within thebackup storage device 208 has an identification of 33 and a minimumoffset 1215. A block of data at address 119 within the backup storagedevice 208 has an identification of 3332 and a minimum offset 17. Ablock of data at address 251 within the backup storage device 208 has anidentification of 1505 and a minimum offset 4901. A block of data ataddress 3009 within the backup storage device 208 has an identificationof 44 and a minimum offset address of 1345. A block of data at address1201 within the backup storage device 208 has an identification of 901and a minimum offset 569. A block of data at address 5009 within thebackup storage device 208 has an identification of 1010 and a minimumoffset 352. A block of data at address 58 within the backup storagedevice 208 has an identification of 8 and a minimum offset 698.

As described above in conjunction with the description of the locationtable 112 in FIG. 3, the backup logic 124 and the garbage collectionlogic 706 use the nonreferencing nodes location table 702 and thereferencing nodes location table 704 to locate blocks of data that arereferenced based on their identifications instead of their actualaddresses within the backup storage device 208. Accordingly, if a firstblock of data includes a reference to a second block of data, the firstblock of data stores the identification of the second block of datainstead of the address. When the second block of data is dereferencedthrough the first block of data, the location tables 702 and 704 areused to translate the identification to the actual address within thebackup storage device 208. Accordingly, when blocks of data are moved orcopied within the backup storage device 208, the location tables 702 and704 only needs to be updated with regard to the change of address forthis block of data (rather than each of the different references in theblocks of data). Moreover, as will be further described below, thegarbage collection logic 706 performs garbage collection on segments atthe tail of the log of backup data 708 based on the minimum offsets1010.

When a block of data is retrieved and stored (and is representative ofor associated with a leaf node of a storage tree) into the log of backupdata 708, the allocator logic 122 generates an entry into thenonreferencing nodes location table 702 that includes the blockidentification and the offset address where the block of data is stored.When a block of data associated with an interior node of a storage treeis created by the tracking logic 120 to allow for the sharing of theblocks of data within and among the storage trees, the tracking logic120 also generates an entry into the referencing nodes location table704 that includes the block identification, the offset address and theminimum offset.

Incremental Garbage Collection Operations

The operations of the backup system 700 will now be described. FIG. 11illustrates a flow diagram for an incremental garbage collection of datastored as a log in a secondary storage, according to one embodiment ofthe invention.

In block 1102 of the flow diagram 1100, the blocks of data that arereferenced/active in a segment to be cleaned at the tail of a log ofbackup data in a backup storage device are located based on a prunedwalking of the maintained storage trees (those still active and notmarked as deleted or set for deletion) in the log. With reference to thebackup system 700, the garbage collection logic 706 locates the blocksof data that are referenced/active in a segment at the tail of the logof backup data 708 in the backup storage device 208. In one embodiment,the garbage collection logic 706 is able to perform a pruned walking ofthe maintained storage trees based on the minimum offset address ofdescendent nodes of a given node (illustrated in the referencing nodeslocation table 704 of FIG. 10B). One embodiment of this locating basedon the minimum offset address for a given node is described in moredetail below in conjunction with the flow diagram 1200 of FIG. 12.Control continues at block 1104.

In block 1104, the blocks of data that are referenced/active within thesegment to be cleaned are copied to the head of the log in the backupstorage device 208. With reference to the backup system 700, the garbagecollection logic 706 copies the blocks of data that arereferenced/active within the segment to the head of the log. Controlcontinues at block 1106.

In block 1106, the addresses of the copied blocks of data are updated.With reference to the backup system 700, the garbage collection logic706 updates the addresses of the copied blocks of data in thenonreferencing nodes location table 702 and the referencing nodeslocation table 704. The garbage collection logic 706 updates thesereferences by updating the entries within the nonreferencing nodeslocation table 702 or referencing nodes location table 704 associatedwith this block of data. As described above, if the copied block of datais a leaf node of the storage tree, the associated entry for the blockof data is stored in the nonreferencing nodes location table 702 and isupdated within the new address. If the copied block of data is aninterior node of the storage tree, the associated entry for the block ofdata is in the referencing nodes location table 704 and is updated withthe new address. In other words, the garbage collection logic 706updates the offset address column 1008 for this entry. Moreover, thegarbage collection logic 706 updates the minimum offset for the currentnode in the referencing nodes location table 704 based on the newaddresses of the blocks of data that were copied and are descendentnodes of the current node. A more detailed description of the updatingof the minimum offset for a node in the referencing nodes location table704 is described in more detail below in conjunction with FIG. 12.Control continues at block 1108.

In block 1108, the segment that is cleaned is designated as unallocated.With reference to the backup system 700, the garbage collection logic706 marks the segment that is cleaned as unallocated. Accordingly, thedata within this segment may be overwritten by other data stored intothe backup system 700. In other words, the blocks of data within thissegment that are referenced/active have been copied, while the otherblocks of data within the segment (unreferenced/inactive) may beoverwritten, as such data is no longer being used. The operations of theflow diagram 1100 are complete with reference to the given segment to becleaned.

A more detailed embodiment of an incremental garbage collectionoperation will now be described. In particular, FIG. 12 illustrates amore detailed flow diagram for an incremental garbage collection of datastored as a log in a secondary storage, according to one embodiment ofthe invention.

In block 1202, a determination is made of whether all storage trees ofblocks of data have been processed. With reference to the backup system700, the garbage collection logic 706 determines whether all storagetrees of blocks of data (as shown in FIG. 4) have been processed. In oneembodiment, the garbage collection logic 706 determines whether allstorage trees of blocks of data have been processed based on whether allof the root nodes of the storage trees have been processed. Inparticular, the operations of the flow diagram 1200 are such that thedescendent nodes of a root node have been processed (including copyingof the associated blocks of data that are within the segment to becleaned to the head of the log) if the root node has been processed.

In block 1204, upon determining that all of the storage trees of blocksof data have not been processed, the root node for an unprocessedstorage tree is designated as the current node. With reference to thebackup system 700 and FIG. 4, the garbage collection logic 706designates a root node of one of the number of unprocessed storage treesas the current node. Control continues at block 1206.

In block 1206, a determination is made of whether the current node haschildren nodes. With reference to the backup system 700 and FIG. 4, thegarbage collection logic 706 determines whether the current node haschildren nodes. In one embodiment, the garbage collection logic 706determines whether the current node has children nodes by determiningwhether the current node references other nodes. For example, thecurrent node could point to one of a number of other nodes. Upondetermining that the current node does not have children nodes, controlcontinues at block 1216, which is described in more detail below.

In block 1208, upon determining that the current node does have childrennodes, a determination is made of whether the minimum offset of thecurrent node is within the segment to be cleaned. With reference to thebackup system 700, the garbage collection logic 706 determines whetherthe minimum offset of the current node is within the segment to becleaned. As described above, the minimum offset of a current node is theminimum valued address among the addresses of the descendent nodes ofthe current node. The minimum offset of a referencing node (i.e., a nodehaving children nodes) is stored as an entry within referencing nodeslocation table 704. This value is then compared to the range ofaddresses of the segment being cleaned. Upon determining that theminimum offset of the current node is not within the segment to becleaned, control continues at block 1216, which is described in moredetail below. As described, the garbage collection operationsillustrated by the flow diagram 1200 clean segments at the tail of thelog. Accordingly, if the minimum offset is not within the segment to becleaned at the tail of the log, no descendent nodes of the current nodeare within the segment to be cleaned. Therefore, these operations allowfor a reduced or pruned search of the blocks of data that arereferenced/active within a segment to be cleaned within the log.

In block 1210, upon determining that the minimum offset of the currentnode is within the segment to be cleaned, a determination is made ofwhether all children nodes of the current node have been processed. Withreference to the backup system 700, the garbage collection logic 706determines whether all children nodes of the current node are processed.In one embodiment, the garbage collection logic 706 makes thisdetermination by tracking the children nodes of the current node andwhich of such nodes have been processed.

In block 1212, upon determining that all of the children nodes have notbeen processed, an unprocessed child node of the current node isdesignated as the current node. With reference to the backup system 700,the garbage collection logic 706 designates one of the unprocessedchildren nodes of the current node as the current node. Controlcontinues at block 1206, wherein a determination is made of whether thecurrent node has children nodes.

In block 1214, upon determining that all of the children nodes of thecurrent node have been processed (from block 1210), the minimum offsetfor the current node is updated with the minimum address among theaddresses of the descendent nodes. With reference to the backup system700, the garbage collection logic 706 updates the minimum offset for thecurrent node in the referencing nodes location table 704 based on thenew addresses of the blocks of data that were copied (as part of theoperations in block 1218 described below) and are descendent nodes ofthe current node.

Therefore, the current node along with its referenced nodes will nothave to be revisited during the continued operations. For example,assume that the descendent nodes of the interior node 416 that arewithin the segment to be cleaned have been copied based on theprocessing of the interior node 416 when the storage tree having theroot node 402 was processed. Accordingly, the minimum offset for theinterior node 416 will not be within the segment to be cleaned.Therefore, when the minimum offset for interior node 416 is checkedduring the processing of the storage tree having the root node 404, itsvalue will be greater than the values of the address space beingcleaned. In other words, the search for referenced/active blocks of datawithin the segment being cleaned is pruned or reduced, therebyincreasing the rate of the garbage collection operations. Moreover, whenthe storage trees are snapshots of data wherein the amount of variationfor the data across the different storage trees is small, the amount ofpruning or reduction in the searching of these blocks of data increases.Control continues at block 1216.

In block 1216, a determination is made of whether the current node iswithin the segment to be cleaned. With reference to the backup system700, the garbage collection logic 706 determines whether the currentnode is within the segment to be cleaned based on whether the address ofthe block of data associated with the current node is within thesegment. The garbage collection logic 706 determines the address of thecurrent node by dereferencing the block identification of the blockassociated with the current node within the referencing nodes locationtable 704. For example, assume that the segment to be cleaned includesaddresses from zero to 100 and that the address of the current node is505 based on the dereferencing of the block identification of thecurrent node using the referencing nodes location table 704. Therefore,the current node is not within the segment to be cleaned. Upondetermining that the current node is not within the segment to becleaned, control continues at block 1220, which is described in moredetail below.

In block 1218, upon determining that the current node is within thesegment to be cleaned, the block of data associated with the currentnode is copied to the head of the log and the address for this copiedblock of data is updated within nonreferencing nodes location table 702or referencing nodes location table 704. With reference to the backupsystem 700, the garbage collection logic 706 copies the block of dataassociated with the current node to the head of the log of the backupdata 708. As described above, the log of backup data 708 includes a tailfrom which the segment to be cleaned is selected and a head wherein thereferenced/active blocks of data within the segment are copied. The headof the log includes storage space that is unallocated. Moreover, when ablock of data is copied to the head of the log, the garbage collectionlogic 706 updates the address of the head of the log to the addressafter the end of the block of data that has been copied to the previoushead of the log. Control continues at block 1220.

In block 1220, a determination is made of whether the current node is aroot node. With reference to the backup system 700, the garbagecollection logic 706 determines whether the current node is a root node.Upon determining that the current node is a root node, control continuesat block 1202.

In block 1222, upon determining that the current node is not a rootnode, the parent node of the current node is designated as the currentnode. With reference to the backup system 700, the garbage collectionlogic 706 designates the parent node of the current node as the currentnode. Control continues at block 1206.

In block 1224, upon determining that all of the storage trees of blocksof data have been processed, the segment to be cleaned is marked asunallocated. With reference to the backup system 700, the garbagecollection logic 706 marks the segment to be cleaned as unallocated.Accordingly, the data within this segment may be overwritten by otherdata stored into the backup system 700. In other words, the blocks ofdata within this segment that are referenced/active have been copied,while the other blocks of data within the segment(unreferenced/inactive) may be overwritten, as such data is no longerbeing used. The operations of the flow diagram 1200 are complete withreference to the given segment to be cleaned.

As described, the operations of the flow diagrams 1100 and 1200 allowfor a reduced or pruned search of the blocks of data that arereferenced/active within the segment to be cleaned within a log.Moreover, once a segment has been cleaned, the other prior segments inthe log are considered cleaned. Returning to FIG. 9 to help illustrate,a first segment to be cleaned at the tail of the log may be from addresszero to address 100, while the second segment to be cleaned may be fromaddress 101 to address 200, etc. Accordingly, when the segment cleanedis from address 1401 to 1500, the addresses that are considered cleaned(unallocated) are from address zero to address 1500.

Further, the size of the segment to be cleaned is variable. For example,the size of the segment can be the length of one block of data.Therefore, the rate of the garbage collection operations would increaseas the number of nodes that is traversed is pruned based on checking theminimum offset address value among descendent nodes. In particular, onlya single block of data is within the segment to be cleaned.

Bloom Filter-Based Garbage Collection Operations and Incremental GarbageCollection Operations of Data in a Secondary Storage

In one embodiment, the Bloom filter-based garbage collection operationscan operate in conjunction with the incremental garbage collectionoperations of a storage device wherein the data is stored as a logwithin the storage device. In particular, FIG. 13 illustrates a blockdiagram of a system that includes the Bloom filter-based garbagecollection operations and the incremental garbage collection operations,according to one embodiment of the invention. Similar to FIGS. 1 and 7,FIG. 13 includes a backup system 1300 and the target system 101. Thetarget system 101 includes the target data 102 that is backed up/storedwithin and by the backup system 1300.

The backup system 1300 includes components from both the backup system100 and the backup system 700. The backup system 1300 includes thebackup logic 124, a garbage collection logic 1302, the nonreferencingnodes location table 702, the referencing nodes location table 704, theactive-blocks probabilistic summary data structure 114, thecandidates-for-cleaning probabilistic summary data structure 115 and thelog of backup data 708. Garbage collection logic 1302 includes a Bloomfilter logic 104. The backup logic 124 includes a tracking logic 120 andan allocator logic 122. As in the backup systems 100 and 700, the backupsystem 1300 includes backup data stored therein.

According to one embodiment, for the cleaning of a segment at the tailof the log (as described in the flow diagrams 1100 and 1200), theoperations include the copying of the blocks of data that areactive/referenced in such segment. In an embodiment, the garbagecollection logic 1302 incorporates the Bloom filter logic 104 togenerate an active-blocks probabilistic summary data structure 114 forthose blocks of data that are referenced/active within the segment to becleaned. Therefore, the garbage collection logic 1302 can locate theblocks of data to be copied and generate the active-blocks probabilisticsummary data structure 114. Subsequently, the garbage collection logic1302 utilizes the active-blocks probabilistic summary data structure 114for the copying of these blocks of data to the head of the log.

Thus, a method and apparatus for different embodiments of garbagecollection of data in a secondary storage have been described. Althoughthe present invention has been described with reference to specificexemplary embodiments, it will be evident that various modifications andchanges may be made to these embodiments without departing from thebroader spirit and scope of the invention. For example, while theapplication of a Bloom filter to the secondary storage of data isdescribed in reference to garbage collection operations of such data, inanother embodiment, the application of the Bloom filter can be appliedto free block management operations for determining if an address withinthe secondary storage currently includes data stored therein. Inparticular, the addresses within the secondary storage having datastored therein could be inputted into a Bloom filter to generate anencoded value representative of those addresses having data.Accordingly, an application could input an address into the Bloom filterto determine if the address has data stored therein.

Moreover, the blocks of data within the backup system 100 may becomprises of different classes, wherein different classes may beprocessed differently with regard to garbage collection. For example,the garbage collection operations described herein may be applied toactive blocks within a range of the address space to be cleaned andwhich are classified as leaf nodes within a storage tree. Therefore, thespecification and drawings are to be regarded in an illustrative ratherthan a restrictive sense.

1. A method comprising: generating a probabilistic summary datastructure based on a Bloom filter that represents active blocks of datawithin a storage device that are referenced by other blocks of databased on identification of the active blocks or the data within theactive blocks; and performing garbage collection of at least a portionof the storage device based on the probabilistic data structure byperforming the following for each block of data within a space to becleaned: applying a probabilistic algorithm on the identification of theblock of data or the data within the block of data, the applyingresulting in a bit vector for each block of data or the data within theblock of data; and comparing the resulting bit vector with theprobabilistic data structure to determine if the block of data isactive.
 2. The method of claim 1, wherein generating the probabilisticsummary data structure that represents active blocks of data within thestorage device comprises: generating a number of hashes based on theidentifications of the active blocks or the data within the activeblocks; and encoding the number of hashes for the active blocks withinthe storage device into the probabilistic summary data structure.
 3. Themethod of claim 2, wherein the identifications of the active blocksinclude a hash of the data within the active blocks.
 4. The method ofclaim 3, wherein the generating of the number of hashes comprisesselecting a bit range of the hash of the data within the active block.5. The method of claim 2, wherein generating a hash based on anidentification of the active block or the data within the active blockwithin the storage device comprises: generating a first hash based onthe identification of the active block or the data within the activeblock; and generating different hashes based on the first hash for theactive block.
 6. The method of claim 5, wherein generating differenthashes based on the first hash for the active block includes selectingdifferent bits within the first hash.
 7. The method of claim 1, whereina size of the encoded value fits within memory of a computing devicethat is coupled to the storage device.
 8. The method of claim 1, whereinperforming garbage collection of at least a portion of the storagedevice based on the probabilistic summary data structure includescopying the active blocks to an unallocated address space within thestorage device based on the determined active blocks.
 9. The method ofclaim 1, wherein the probabilistic summary data structure indicates thatat least one inactive block is an active block.
 10. The method of claim1, wherein the blocks stored in the storage device that are marked asallocated are non-modifiable.
 11. A method comprising: for eachreferenced block of data with at least a portion of an allocated addressspace in a storage device, performing the following: generating a numberof hash values based on hashes of an identification of a block or thedata in the block within the storage device, and setting bits within aprobabilistic summary data structure, the probabilistic summary datastructure having been generated based on a Bloom filter, at offsetsequal to each of the number of hash values, wherein a size of theprobabilistic summary data structure fits within memory of a computingdevice that accesses the storage device; and reclaiming the at least aportion of the allocated address space based on the probabilisticsummary data structure.
 12. The method of claim 11, wherein reclaimingthe at least a portion of the allocated address space based on theprobabilistic summary data structure comprises: performing the followingoperations until an identification of each allocated block stored in atable has been processed, the operations including: generating a numberof hash values based on hashes of an identification of a block, anddetermining whether the block is referenced based on the bit valueswithin the summary data structure that are at offsets equal to the hashvalues.
 13. The method of claim 12, wherein the performing the followingoperations until the identification of each allocated block stored inthe table has been processed includes, marking a block as unallocatedwhen at least one of the bits is not set within the summary datastructure at the offsets equaling the hash values for the identificationof the block.
 14. The method of claim 12, wherein performing thefollowing operations until the identification of each allocated blockstored in the table has been processed, the operations including:copying a block that is referenced to an unallocated address space inthe storage device, upon determining, for each of the number of hashvalues, that a bit within the bit vector at an offset equal to a hashvalue is set, and marking the at least a portion of the allocatedaddress space as unallocated.
 15. A method comprising: generating afirst encoded value based on a first Bloom filter, the first encodedvalue representative of blocks of data within an allocated address spaceto be cleaned within a storage device; locating blocks of data that arecurrently references be at least one other block of data and are withinan allocated address space to be cleaned based on the first encodedvalue; generating a second encoded value based on a second Bloom filter,the second encoded value representative of the blocks of data that arecurrently referenced and within the allocated address space to becleaned; and reclaiming at least a portion of the allocated addressspace based on the first encoded value and the second encoded value;wherein the generating the second encoded value includes performing thefollowing for each located block: applying the first Bloom filter on thelocated block, and comparing the result of applying the first Bloomfilter on the located block to the first encoded value, if there is amatch, performing the following, applying the second Bloom filter on thelocated block, and storing the result of applying the second Bloomfilter on the located block in the second encoded value.
 16. The methodof claim 15 wherein the reclaiming includes copying the blocks that arecurrently referenced by at least one reference source and within theallocated address space of the storage device to an unallocated addressspace of the storage device.
 17. The method of claim 16 wherein thereclaiming includes marking the allocated address space of the storagedevice as unallocated address space.
 18. The method of claim 15, whereinthe second encoded value fits within local memory within a computingdevice that accesses the storage device.
 19. A system comprising: astorage device having stored therein a number of blocks of data, whereinsome of the blocks of data are active and some might be inactive; amemory having stored therein a probabilistic summary data structure thatrepresents the blocks of data that are active and within space to becleaned within the storage device; and a garbage collection logic thatgenerated the probabilistic summary data structure based on a Bloomfilter and performs garbage collection on the space through comparisonof the probabilistic summary data structure to a bit vector generatedfor each block within the space, wherein each bit vector is generated bythe garbage collection logic from an application of the Bloom filteronto an identification of the blocks of data or the data within theblocks of data.
 20. The system of claim 19, wherein the garbagecollection logic is to copy the blocks of data that are currentlyreferenced and within the allocated address space to be cleaned withinthe storage device to an unallocated address space of the storagedevice.
 21. The system of claim 20, wherein the garbage collection logicis to mark the allocated address space to be cleaned within the storagedevice as unallocated address space.
 22. A machine storage medium thatprovides instructions, which when executed by a machine, cause saidmachine to perform operations comprising: generating a probabilisticsummary data structure based on a Bloom filter that represents activeblocks of data within a storage device that are referenced by otherblocks of data based on identification of the active blocks or the datawithin the active blocks; and performing garbage collection of at leasta portion of the storage device based on the probabilistic datastructure by performing the following for each block of data within aspace to be cleaned: applying a probabilistic algorithm on theidentification of the block of data or the data within the block ofdata, the application resulting in a bit vector for each block of dataor the data within the block of data; and comparing the resulting bitvector with the probabilistic data structure to determine if the blockof data is active.
 23. The machine storage medium of claim 22, whereingenerating the probabilistic summary data structure that representsactive blocks of data within the storage device comprises: generating anumber of hashes based on the identifications of the active blocks orthe data within the active blocks; and encoding the number of hashes forthe active blocks within the storage device into the probabilisticsummary data structure.
 24. The machine storage medium of claim 23,wherein the identifications of the active blocks include a hash of thedata within the active blocks.
 25. The machined storage medium of claim23, wherein the generating of the number of hashes comprises selecting abit range of the hash of the data within the active block.
 26. Themachine storage medium of claim 23, wherein generating a hash based onan identification of the active block or the data within the activeblock within the storage device comprises: generating a first hash basedon the identification of the active block or the data within the activeblock; and generating different hashes based on the first hash for theactive block.
 27. The machine storage medium of claim 22, wherein theprobabilistic summary data structure indicates that at least oneinactive block is an active block.
 28. A machine storage medium thatprovides instructions, which when executed by a machine, cause saidmachine to perform operations comprising: for each referenced block ofdata with at least a portion of an allocated address space in a storagedevice, performing the following: generating a number of hash valuesbased on hashes of an identification of a block or the data in the blockwithin the storage device, and setting bits within a probabilisticsummary data structure, the probabilistic summary data structure havingbeen generated based on a Bloom filter, at offsets equal to each of thenumber of hash values, wherein a size of the probabilistic summary datastructure fits within memory of a computing device that accesses thestorage device; and reclaiming the at least a portion of the allocatedaddress space based on the probabilistic summary data structure.
 29. Themachine storage medium of claim 28, wherein reclaiming the at least aportion of the allocated address space based on the probabilisticsummary data structure includes: performing the following operationsuntil an identification of each allocated block stored in a table hasbeen processed: generating a number of hash values based on hashes of anidentification of a block, and determining whether the block isreferenced based on the bit values within the summary data structurethat are at offsets equal to the hash values.
 30. The machine storagemedium of claim 29, wherein performing the following operations untilthe identification of each allocated block stored in the table has beenprocessed comprises: marking a block as unallocated when at least one ofthe bits is not set within the summary data structure at the offsetsequaling the hash values for the identification of the block.
 31. Themachine storage medium of claim 29, wherein performing the followingoperations until the identification of each allocated block stored inthe table has been processed, the operations comprising: copying a blockthat is referenced to an unallocated address space in the storagedevice, upon determining, for each of the number of hash values, that abit within a bit vector at an offset equal to a hash value is set; andmarking the at least a portion of the allocated address space asunallocated.
 32. A machine storage medium that provides instructions,which when executed by a machine, cause said machine to performoperations comprising: generating a first encoded value based on a firstBloom filter, the first encoded value representative of blocks of datawithin an allocated address space to be cleaned within a storage device;locating blocks of data that are currently references be at least oneother block of data and are within an allocated address space to becleaned based on the first encoded value; generating a second encodedvalue based on a second Bloom filter, the second encoded valuerepresentative of the blocks of data that are currently referenced andwithin the allocated address space to be cleaned; and reclaiming atleast a portion of the allocated address space based on the firstencoded value and the second encoded value; wherein the generating thesecond encoded value includes performing the following for each locatedblock: applying the first Bloom filter on the located block, andcomparing the result of applying the first Bloom filter on the locatedblock to the first encoded value, if there is a match, performing thefollowing, applying the second Bloom filter on the located block, andstoring the result of applying the second Bloom filter on the locatedblock in the second encoded value.
 33. The machine storage medium ofclaim 32 comprising copying the blocks that are currently referenced byat least one reference source and within the allocated address space ofthe storage device to an unallocated address space of the storagedevice.